﻿using System;
using System.Windows.Forms;
using pinduoduo.Model;
using pinduoduo.Service;

namespace pinduoduo
{
    public partial class AddToken : Form
    {
        public AddToken()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

            if (string.IsNullOrWhiteSpace(this.PDDAccessToken.Text) || string.IsNullOrWhiteSpace(this.pdd_user_id.Text))
            {
                MessageBox.Show("数据不能为空");
                return;
            }
            PddToken pddToken = new PddToken();
            pddToken.PDDAccessToken = this.PDDAccessToken.Text;
            pddToken.pdd_user_id = this.pdd_user_id.Text;

            PddTokenService pddTokenService = new PddTokenService();

            var id = pddTokenService.InsertToken(pddToken, true);

            this.DialogResult = DialogResult.OK;
        }
    }
}
